/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.kimstore.gui.stocksarrival;

import com.kimstore.bean.Product;
import com.kimstore.factory.DaoFactory;

/**
 *
 * @author Administrator
 */
public class SelectProductController {

    private AddItemToStocksController parentController;
    private SelectProductWindow window;
    
    public SelectProductController(AddItemToStocksController parentController) {
        this.parentController = parentController;
    }
    
    public void displayWindow(){
        window = new SelectProductWindow(this);
        window.populateTable(DaoFactory.getInstance().getProductDao().findAllActive());
        window.displayWindow();
    }
    
    public void fromWindow(String productName){       
        parentController.createSelectProductControllerCallback(DaoFactory.getInstance().getProductDao().findByName(productName));
    }
}
